package br.com.lavitstudio.game;

import java.awt.Point;

public class CollidingWith {
	public static boolean isCollidingWithBlock(int getX, int getY, Point pt1, Point pt2) {
		for(int x=(getX/Tile.tileSize); x<(int) (getX/Tile.tileSize + 3); x++){
			for(int y=(int) (getY/Tile.tileSize); y<(int) (getY/Tile.tileSize + 3); y++){
				if(x >= 0 && y >= 0 && x < Level.block.length && y < Level.block[0].length)
				if(Level.block[x][y].id != Tile.block.get("air") && Level.block[x][y].id != Tile.block.get("cave") && Level.block[x][y].id != Tile.block.get("wood") && Level.block[x][y].id != Tile.block.get("leaves")) {
					if(Level.block[x][y].contains(pt1) || Level.block[x][y].contains(pt2)) {
						return true;
					}
				}
			}			
		}
		return false;
	}
}
